Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DB Migrations #1158

Merged
merged 3 commits into from
Sep 29, 2023
Merged

Fix DB Migrations #1158

merged 3 commits into from
Sep 29, 2023

Conversation

Mythicaeda
Copy link
Contributor

@Mythicaeda Mythicaeda commented Sep 28, 2023

  • Tickets addressed: Hotfix
  • Review: By commit
  • Merge strategy: Merge (no squash)

Description

Resolves three bugs in our migrations:

  1. In the AerieMerlin users migration, Aerie Legacy could accidentally get into the users table early. This would most likely occur as a side-effect of the tags migration using the username to indicate that a tag was from a version of Aerie prior to the tags table. This would cause a constraint violation when the migration went to assign allowed roles to all users added, and even if it didn't, there would be an on-insert conflict when the system users were properly added. This has been resolved by deleting the system users if they exist after all the insertions have occurred.
  2. In the AerieScheduler definition_consistency migration, rows with a null definition field would violate the added not null constraint. This has been resolved by updating the rows with a null field to the default value for the row before setting the not null.
  3. Migration 26 in AerieMerlin was missing a mark_migration_rolled_back call in the down.sql

Verification

Manual Verification in two ways:

  1. I spun up a fresh Aerie, reverted migrations until I had reverted the two problem migrations. I then applied the bug situations (adding two tags, one whose owner was Aerie Legacy and another whose owner was Mission Model; adding a scheduling goal and scheduling constraint with null definition fields). I then migrated the database up to the latest version. All migrations were done using our Python DB migration helper.
  2. Clipper had a deployment that was encountering these bugs. After running (1), these migrations were used to successfully migrate that DB from 1.7.0 to 1.12.0.

Documentation

No docs need to be updated.

Future work

Related to (3), I've created this issue

@Mythicaeda Mythicaeda added fix A bug fix database Anything related to the database labels Sep 28, 2023
@Mythicaeda Mythicaeda added this to the FY23 Q4 - Bug Fixes milestone Sep 28, 2023
@Mythicaeda Mythicaeda requested a review from a team as a code owner September 28, 2023 17:20
@Mythicaeda Mythicaeda temporarily deployed to e2e-test September 28, 2023 17:20 — with GitHub Actions Inactive
@Mythicaeda Mythicaeda temporarily deployed to e2e-test September 28, 2023 17:20 — with GitHub Actions Inactive
@Mythicaeda Mythicaeda temporarily deployed to e2e-test September 28, 2023 17:27 — with GitHub Actions Inactive
@Mythicaeda Mythicaeda temporarily deployed to e2e-test September 28, 2023 17:27 — with GitHub Actions Inactive
@Mythicaeda Mythicaeda temporarily deployed to e2e-test September 28, 2023 17:27 — with GitHub Actions Inactive
@mattdailis
Copy link
Collaborator

Could you elaborate on the manual verification steps? I'm not sure I understand the issue well enough to reproduce it

@Mythicaeda
Copy link
Contributor Author

Could you elaborate on the manual verification steps?

Added elaboration 👍

@skovati
Copy link
Contributor

skovati commented Sep 29, 2023

Just to confirm, these fixes are for deployments that haven't applied these migrations yet, and don't need to be backfixed for e.g. aerie-dev?

@Mythicaeda
Copy link
Contributor Author

@skovati Yes

@Mythicaeda Mythicaeda temporarily deployed to e2e-test September 29, 2023 18:03 — with GitHub Actions Inactive
@Mythicaeda Mythicaeda temporarily deployed to e2e-test September 29, 2023 18:03 — with GitHub Actions Inactive
@Mythicaeda Mythicaeda temporarily deployed to e2e-test September 29, 2023 18:03 — with GitHub Actions Inactive
@Mythicaeda Mythicaeda merged commit c45dad9 into develop Sep 29, 2023
10 checks passed
@Mythicaeda Mythicaeda deleted the fix/migrations branch September 29, 2023 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
database Anything related to the database fix A bug fix
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants